const {BrowserWindow} = require('electron')
const config = require('../../config/app.config')

let createBrowserWindow = (filepath, params)=>{
    //创建BrowserWindow
    let win = new BrowserWindow(params)
    win.data1 = "aaaaa"
    win.once('ready-to-show', ()=>{
        win.show()
    })
    //url
    win.loadFile(filepath);
    //调试
    if (config.debug){
        win.webContents.openDevTools()
    }
    win.on('closed', ()=>{
        win = null
    })

    return win
}

module.exports.createBrowserWindow = createBrowserWindow
